package com.axc.gallery2.view;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import com.axc.gallery2.dbhelper.ImageInfo;

public class SampleSize {
    
    public Bitmap getSampleSize(Bitmap bitmap)
    {
        
        return bitmap;
    }
    public static Bitmap getSampleSize(String path)
    {
        // bitmap size exceeds VM budget 的解决办法
        BitmapFactory.Options options = new BitmapFactory.Options();
        try {
			ImageInfo imageInfo = new ImageInfo(path);
			options.inSampleSize = 5;
			System.out.println("length:"+imageInfo.getILenth()+"inSampleSize:"+Math.pow((Math.sqrt(imageInfo.getILenth()/100)),2));
        } catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        Bitmap bitmap = BitmapFactory.decodeFile(path, options);
        return bitmap;
    }

}
